<div class="container" >
    <div class="row">
        <!--<div class="col-md-12">-->
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">报警列表</h3>
                </div>

                <div class="panel-body">
                    <form role="form" class="form-horizontal">
                        <div class="form-group">
                            <div class="col-md-12 col-sm-12 col-xs-12">
                                <label  class="col-sm-1 control-label">设备</label>
                                <div class="col-sm-2">
                                    <select name="$index_valueType"class="form-control input-sm" ng-model="quereyData.devId" ng-change="changeDevId()">
                                        <option value="">全部</option>
                                        <option value="{{val.dev_id}}"  ng-repeat="(key, val) in devList" >{{val.name}}</option>
                                    </select>
                                </div>

                                <label  class="col-sm-1 control-label">属性</label>
                                <div class="col-sm-2">
                                    <select name="$index_valueType"class="form-control input-sm" ng-model="quereyData.attrId"  ng-change="changeAttr()">
                                        <option value="">全部</option>
                                        <option value="{{val.id}}"  ng-repeat="(key, val) in attrList" >{{val.attrName}}</option>
                                    </select>
                                </div>

                                <label  class="col-sm-1 control-label">状态</label>
                                <div class="col-sm-1">
                                    <select class="form-control input-sm" ng-model="quereyData.status" ng-change="init()">
                                        <option value=""  >全部</option>
                                        <option value="A"  >报警</option>
                                        <option value="N"  >已处理</option>
                                    </select>
                                </div>

                               <label  class="col-sm-1 control-label">时间</label>
                                <div class="col-sm-3">
                                    <div class="input-group">
                                        <input type="text" class="form-control" style="z-index: 1"  id="datepickerStrat" ng-model="quereyData.start" >
                                        <span class="input-group-addon">到</span>
                                        <input type="text" class="form-control"  style="z-index: 1"   id="datepickerEnd"  ng-model="quereyData.end" >
                                    </div>
                                </div>


                            </div>
                        </div>

                    </form>

                    <div class="row m-t-10">
                        <div class="col-md-12 col-sm-12 col-xs-12">
                            <div class="table-responsive">
                                <table class="table">
                                    <thead>
                                    <tr>
                                        <th>设备名称</th>
                                        <th>数据点名称</th>
                                        <th>当前值</th>
                                        <th>报警时间</th>
                                        <th>状态</th>
                                        <th ng-if="$root.edit_cmp">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr ng-repeat="entity in data"  >
                                        <td ng-bind="entity.name" ></td>
                                        <td ng-bind="entity.attr_name"  ></td>
                                        <td>
                                        <span  ng-if="entity.data_type == 'ALARM_TYPE'">
                                                        <span ng-if="entity.data_value == '0000'">正常</span>
                                                        <span ng-if="entity.data_value == '0001'">报警</span>
                                                        <span ng-if="entity.data_value == 'ERR'">异常数据</span>
                                                    </span>
                                        <span  ng-if="entity.data_type == 'SWITCH_TYPE'">
                                                        <span ng-if="entity.data_value == '0000'">开</span>
                                                        <span ng-if="entity.data_value == '0001'">关</span>
                                                        <span ng-if="entity.data_value == 'ERR'">异常数据</span>
                                                    </span>
                                        <span ng-if="entity.data_type != 'ALARM_TYPE' && entity.data_type != 'SWITCH_TYPE'">{{entity.data_value}}{{entity.unit}}</span>
                                        </td>
                                        <td ng-bind="entity.udp_date | date:'yyyy-MM-dd HH:mm:ss'"  ></td>
                                        <td ng-if="entity.data_status == 'A' ">报警</td>
                                        <td ng-if="entity.data_status == 'N' ">已处理</td>
                                        <td ng-if="entity.data_status == 'ERR' ">数据异常</td>

                                        <td ng-if="$root.edit_cmp">
                                         <!--   <button class="btn btn-icon waves-effect waves-light btn-info btn-sm m-b-5" ng-click="gotoModel(entity)">
                                                <i class="fa fa-pencil" style="color:  #fff;"></i>
                                            </button>-->
                                            <a href="javascript:void(0)" ng-click="selectAlarm(entity)"  data-toggle="modal" data-target="#update-alarm-modal"><i class="fa fa-pencil"></i></a>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <page-info pages="pages" curpage="quereyData.page" total="total" change="changePage(page)"></page-info>
                    </div>
                </div>

                <div id="update-alarm-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="alarmModalLabel" aria-hidden="true" style="display: none">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="closeAlarm()">×</button>
                                <h4 class="modal-title">报警处理</h4>
                            </div>
                            <form class="modal-body" ng-submit="updateAlarm()"   name="updateAlarmForm" >
                                <div class="row">
                                    <div class="col-md-12">
                                        <div class="form-group">
                                            <label  class="control-label">状态<span style="color: red">*</span></label>
                                           <!-- <input type="radio" name="a" value="A" ng-model="alarmStatus" ng-checked="true">报警
                                            <input type="radio" name="n" value="N" ng-model="alarmStatus">已处理-->
                                            <div>
                                                <div class="radio radio-info radio-inline">
                                                    <input id="inlineRadio1" type="radio" name="a" value="A" ng-model="alarmStatus" >
                                                    <label for="inlineRadio1"> 报警 </label>
                                                </div>

                                                <div class="radio radio-info radio-inline">
                                                    <input id="inlineRadio2"  type="radio" name="n" value="N" ng-model="alarmStatus" >
                                                    <label for="inlineRadio2"> 已处理 </label>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-12">
                                        <div class="form-group">
                                            <label  class="control-label">描述<span style="color: red">*</span></label>
                                            <input type="text" class="form-control"   required  ng-model="record" name="record" maxlength="100">
                                        </div>
                                    </div>

                                </div>
                                <div class="modal-footer">
                                    <button id="updateAlarm" type="button" class="btn btn-default waves-effect" data-dismiss="modal" ng-click="closeAlarm()">关闭</button>
                                    <button type="submit" class="btn btn-info waves-effect waves-light"  ng-disabled="updateAlarmForm.$invalid ">保存</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
<!--        </div>-->

    </div>


</div>